# Maintainer: Konstantin Podsvirov <konstantin@podsvirov.pro>

_realname=goxel
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=0.11.0
pkgrel=1
pkgdesc="3D program that lets you create voxel volumes (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang32' 'clang64')
url="https://goxel.xyz/"
license=('GPL3')
depends=("${MINGW_PACKAGE_PREFIX}-glfw"
         "${MINGW_PACKAGE_PREFIX}-glew"
         "${MINGW_PACKAGE_PREFIX}-libpng"
         "${MINGW_PACKAGE_PREFIX}-libiconv"
         "${MINGW_PACKAGE_PREFIX}-gettext"
         "${MINGW_PACKAGE_PREFIX}-libtre")
makedepends=("${MINGW_PACKAGE_PREFIX}-scons"
             "${MINGW_PACKAGE_PREFIX}-pkgconf"
             "${MINGW_PACKAGE_PREFIX}-cc")
source=("$_realname-$pkgver.tar.gz::https://github.com/guillaumechereau/$_realname/archive/v$pkgver.tar.gz"
        "001-goxel-0.11.0-msys-mingw.patch")
sha256sums=('660030e1b3b33a3e909d8189780a192cba059774af57b042ecb63297f2a6d0fc'
            'd2fdc56fa3ca85c89c8f843423177a2b58cd2346bed53da19201ef5059da6cd0')

prepare() {
  cd $_realname-$pkgver

  patch -Np1 -i "${srcdir}/001-goxel-0.11.0-msys-mingw.patch"
}

build() {
  msg "Build for ${MSYSTEM}"

  rm -rf build-${MSYSTEM} | true
  cp -r "${_realname}-${pkgver}" "build-${MSYSTEM}"
  cd "${srcdir}/build-${MSYSTEM}"

  make release
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"

  make DESTDIR="$pkgdir" PREFIX=${MINGW_PREFIX} install

  install -D -m644 COPYING "${pkgdir}${MINGW_PREFIX}/share/licenses/$_realname/LICENSE"
}
